/*
 * @Description:
 * @Author: Cxy
 * @Date: 2023-04-28 16:31:29
 * @LastEditors: Cxy
 * @LastEditTime: 2024-12-22 15:11:33
 * @FilePath: \xy-admin\play\src\api\example.ts
 */
import { get, post, postUpload } from './index'

/* 代理 */
// 默认代理
export const defaultApi = (params: any) => get('/default', params)
// 别名代理
export const aliasApi = (params: any) => post('/alias/a', params)
// 无别名代理
export const noAliasApi = (params: any) => post('/noAliasApi/a', params)
// path不清空
export const notResetPathApi = (params: any) => post('/notResetPathApi/a', params)

/* 传参 */
// get传参 直接传对象 自动拼接成在url里
export const getZhengChangApi = (params: any) => get(`/get`, params)
// get传参 手动拼接成在url里
export const getPinJieApi = (url: any = '') => get(`/get?${url}`)
// post传参 正常
export const postZhengChangApi = (data: any) => post('/post', data)
// post传参 带params
export const postParamsApi = (data: any, params: any) => post('/post', data, { params })
// 文件上传 正常
export const postZhengchangUploadApi = (data: any, progressFun: ProgressFun, config?: AxiosRequestAbortKeyConfig) =>
  postUpload('/upload', data, progressFun, config)
// 文件上传 带params
export const postParamsUploadApi = (
  data: any,
  params: any,
  progressFun: ProgressFun,
  config?: AxiosRequestAbortKeyConfig
) => postUpload('/upload', data, progressFun, { params, ...config })
